package 模板方法模式.Tea1;

public abstract class CaffeineBeverage {
    final void prepareRecipe() {
        boilWater();
        brew();
        pourInCup();
        addCondiments();
    }

    abstract void brew();

    abstract void addCondiments();

    void boilWater() {
        System.out.println("Boiling water");
    }

    void pourInCup() {
        System.out.println("Pouring into cup");
    }
}

class Tea extends CaffeineBeverage {

    @Override
    void brew() {
        System.out.println("Steeping the tea");

    }

    @Override
    void addCondiments() {
        System.out.println("Adding Lemon");

    }

}

class Coffee extends CaffeineBeverage {

    @Override
    void brew() {
        System.out.println("Dripping Coffee through filter");

    }

    @Override
    void addCondiments() {
        System.out.println("Adding Sugar and Milk");

    }

}